<template>
  <div class="w-full p-10 print-style relative bg-white h-full">
    <div class="flex items-center">
      <div class="flex justify-center flex-col">
        <div class="text-center">{{ getSystemConfig('HISNAME') }}</div>
        <BaseBarcode v-if="formatData.admissionCode" :value="formatData.admissionCode" />
      </div>
      <div class="ml-3">
        <div class="mb-2">
          <span>{{ formatData?.brName }}</span>
          <span class="ml-10 mr-5">{{ formatData?.brXb }}</span>
          <span>{{ formatData?.brAge }}</span>
        </div>
        <div class="text-[12px]">床位:{{ formatData?.wardbed }}</div>
        <div class="text-[12px] my-2">诊断:{{ formatData?.icd10Name }}</div>
        <div class="text-[12px]">过敏史:{{ formatData?.brGms }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { getSystemConfig } from '@/utils/systemConfig'

const props = defineProps({
  printData: {
    type: Object,
    default: () => ({})
  }
})

const formatData = ref({})

watch(
  () => props.printData,
  () => {
    if (props.printData.printData?.detail.length) {
      formatData.value = props.printData.printData?.detail[0]
    }
  }
)
</script>

<style lang="less" scoped>
@media print {
  @page {
    size: 21cm 29.7cm;
  }
}
</style>
